﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace DatabaseBackup.Library
{
    public static class Helpers
    {
        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["SQLServer"].ConnectionString;
            }
        }

        public static bool CompressFiles
        {
            get
            {
                return bool.Parse(ConfigurationManager.AppSettings["CompressFiles"]);
            }
        }

        public static string BackupFolder
        {
            get
            {
                return ConfigurationManager.AppSettings["BackupFolder"];
            }
        }

        public static int RetentionPeriod
        {
            get
            {
                return int.Parse(ConfigurationManager.AppSettings["RetentionPeriod"]);
            }
        }

        public static string DatabaseName
        {
            get
            {
                return ConfigurationManager.AppSettings["DatabaseName"];
            }
        }

        public static string ErrorLogLocation
        {
            get
            {
                return ConfigurationManager.AppSettings["ErrorLogLocation"];
            }
        }

        public static string ErrorLogEmail
        {
            get
            {
                return ConfigurationManager.AppSettings["ErrorLogEmail"];
            }
        }

        public static bool FTPEnabled
        {
            get
            {
                return bool.Parse(ConfigurationManager.AppSettings["FTPFiles"]);
            }
        }

        public static string AmazonKey
        {
            get
            {
                return ConfigurationManager.AppSettings["AmazonKey"].Trim();
            }
        }

        public static string AmazonSecret
        {
            get
            {
                return ConfigurationManager.AppSettings["AmazonSecret"].Trim();
            }
        }

        public static string AmazonBucket
        {
            get
            {
                return ConfigurationManager.AppSettings["AmazonBucket"].Trim();
            }
        }

        public static string[] Databases
        {
            get
            {
                return Helpers.DatabaseName.Split(new char[] { ',' });
            }
        }
    }
}
